package cn.tedu.tmall.admin.mall.aop;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class TimerAspect {
    @Around("execution(* cn.tedu.tmall.admin.mall.service.*.*(..))")
    public Object xxx(ProceedingJoinPoint pjp) throws Throwable{
        long start = System.currentTimeMillis();
        Object proceed = pjp.proceed();
        long end = System.currentTimeMillis();
        System.out.println("执行耗时:"+(end-start)+"ms");
        return proceed;
    }
}
